<?php

namespace App\Imports;

use Illuminate\Support\Collection;
use Maatwebsite\Excel\Concerns\ToCollection;
use App\Model\User;

class TestImport implements ToCollection
{
    /**
    * @param Collection $collection
    */
    public function collection(Collection $collection)
    {
        foreach($collection as $collect){
            User::create([
                'id'=>$collect[0],
                'username'=>$collect[1],
                'age'=>$collect[2],
                'subject'=>$collect[3],
                'score'=>$collect[4],
            ]);
        }
    }
}
